<template>
	<view class="mainpadding">
		<u-modal :show="show" cancelColor="#555" confirmColor="#208BFF" :showCancelButton="true" :title="title"
			@cancel="show=false" @confirm="confirm"></u-modal>
		<view class="flexbetween xiahuax" @click="tzshdz">
			<view class="notitletext">我的地址</view>
			<view class="right_icon"></view>
		</view>
		<view class="flexbetween xiahuax margin_top" @click="shiming">
			<view class="notitletext">实名认证</view>
			<view class="right_icon"></view>
		</view>
		<view class="flexbetween xiahuax margin_top" @click="qiye">
			<view class="notitletext">企业认证</view>
			<view class="right_icon"></view>
		</view>
		<view class="flexbetween xiahuax margin_top" @click="jumpurl('/pages/mypage/guanyuwm?type=4')">
			<view class="notitletext">VIP申请</view>
			<view class="right_icon"></view>
		</view>
		<view class="flexbetween xiahuax margin_top" @click="jianyi">
			<view class="notitletext">意见建议</view>
			<view class="right_icon"></view>
		</view>
		<view class="flexbetween xiahuax margin_top" @click="guanli" v-if="shop_apply_status==2">
			<view class="notitletext">企业管理</view>
			<view class="right_icon"></view>
		</view>
		<view class="gudingdb">
			<view class="bigbtn" @click="show = true">退出登录</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				show: false,
				title: '确定要退出当前账户么？',
				shop_apply_status:"",//0=未认证，1=认证审核中，2=认证成功，3=认证被拒
				realname_status:"",
				qiyerzisshow:false,
			}
		},
		onShow() {
			this.getinfo()
		},
		methods: {
			jumpurl(url) {
				uni.navigateTo({
					url
				})
			},
			getinfo() {
				httpRequest.request('/api/user/index', 'POST', {}, false, false, true).then(res => {
					if (res.code == 1) {
						this.shop_apply_status = res.data.shop_apply_status
						this.realname_status = res.data.realname_status
						this.qiyerzisshow = res.data.realname_status==3?true:false
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			jianyi() {
				uni.navigateTo({
					url: '/pages/mypage/yijianfk'
				})
			},
			//企业管理
			guanli() {
				uni.navigateTo({
					url: '/pages/mypage/qiyeguanli'
				})
			},
			shiming() {
				if(this.realname_status==1 || this.realname_status==null){
					uni.navigateTo({
						url: '/pages/mypage/shimingrz'
					})
				}else{
					uni.navigateTo({
						url: '/pages/mypage/shenhe'
					})
				}
				
			},
			guanyuwm() {
				uni.navigateTo({
					url: '/pages/mypage/guanyuwm?type=1'
				})
			},
			tzshdz(){
				uni.navigateTo({
					url: '/pages/shopping/shouhuodizhi'
				})
			},
			qiye() {
				// if(!this.qiyerzisshow){
				// 	httpRequest.toast("您还未完成实名认证，请完成实名认证后再进行企业认证")
				// 	return false
				// }
				if(this.shop_apply_status==0 || this.shop_apply_status==null){
					uni.navigateTo({
						url: '/pages/mypage/qiyerz'
					})
				}else{
					uni.navigateTo({
						url:"/pages/mypage/shenheqyrz"
					})
				}
				
			},
			confirm() {
				uni.removeStorageSync('token');
				uni.removeStorageSync('user_id');
				// uni.navigateBack(1)
				uni.reLaunch({
					url:"/pages/login/wiexinhydl"
				})
			},

		}
	}
</script>

<style lang="scss" scoped>
	.xiahuax {
		padding: 20rpx 0;
		border-bottom: 2rpx solid rgba(153, 153, 153, 0.05);
	}
</style>
